# 三色二极管 呼吸灯

import RPi.GPIO as GP
import time

GP.setmode(GP.BOARD)
GP.setwarnings(False)
# 11:红12:绿 13:蓝
GP.setup((11,12,13),GP.OUT)
pwm_list=[GP.PWM(11,50),GP.PWM(12,50),GP.PWM(13,50)]
for p in pwm_list:
    p.start(0)

for j in range(6):
	    # if j%3==0:
	print(j%3)
	for i in range(1,20):

	    #time.sleep(1)
	    pwm_list[j%3].ChangeDutyCycle(i*5)
	    time.sleep(0.1)
	for i in range(20,1,-1):
	    pwm_list[j%3].ChangeDutyCycle(i*5)
	    time.sleep(0.1)
	pwm_list[j%3].ChangeDutyCycle(0)
    # elif j%3==1:
    #     for i in range(1,20):
    #         #time.sleep(1)
    #         pwmr.ChangeDutyCycle(i*1.5)
    #         time.sleep(0.1)
    #     for i in range(20,1,-1):
    #         pwmr.ChangeDutyCycle(i*1.5)
    #         time.sleep(0.1)
    #     pwmr.ChangeDutyCycle(0)
    # else:
    #     for i in range(1,20):
    #         #time.sleep(1)
    #         pwmb.ChangeDutyCycle(i*1.5)
    #         time.sleep(0.1)
    #     for i in range(20,1,-1):
    #         pwmb.ChangeDutyCycle(i*1.5)
    #         time.sleep(0.1)
    #     pwmb.ChangeDutyCycle(0)

for p in pwm_list:
    p.stop()
GP.cleanup()